/*
 * Copyright (c) 2015. Visionet and/or its affiliates. All right reserved.
 * VISIONET PROPRIETARY/CONFIDENTIAL.
 */
package com.visionet.jumper.core.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;

import com.visionet.jumper.core.domain.bean.Page;
import com.visionet.jumper.core.domain.search.Searchable;

/**
 * @author Sin
 * @date 11/30/2015.
 */
@NoRepositoryBean
public interface BaseRepository<M> extends JpaRepository<M, String> {

	/**
	 *  查询实体结果集
	 * @param searchable 查询条件
	 * @return
	 */
	List<M> findAll(Searchable searchable);

	/**
	 *  分页查询实体结果集
	 * @param searchable
	 * @return
	 */
	Page findAllForPage(Searchable searchable);

	/**
	 * 查询泛型对象结果集，查询结果以泛型对象承接
	 * @param searchable 查询条件
	 * @return
	 */
	<T> List<T> findALLForSpecifyType(Searchable searchable, Class<T> c);

	<T> Page findPageForSpecifyType(Searchable searchable, Class<T> c);
	
	long count(Searchable searchable);
}
